import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { FacilityInfoVO, FacilityInfoForm, FacilityInfoQuery } from '@/api/apartment/attribute/facilityInfo/types';

/**
 * 查询配套信息列表
 * @param query
 * @returns {*}
 */

export const listFacilityInfo = (query?: FacilityInfoQuery): AxiosPromise<FacilityInfoVO[]> => {
  return request({
    url: '/apartment/facilityInfo/list',
    method: 'post',
    data: query
  });
};

/**
 * 查询配套信息详细
 * @param id
 */
export const getFacilityInfo = (id: string | number): AxiosPromise<FacilityInfoVO> => {
  return request({
    url: '/apartment/facilityInfo/' + id,
    method: 'get'
  });
};

/**
 * 新增配套信息
 * @param data
 */
export const addFacilityInfo = (data: FacilityInfoForm) => {
  return request({
    url: '/apartment/facilityInfo',
    method: 'post',
    data: data
  });
};

/**
 * 修改配套信息
 * @param data
 */
export const updateFacilityInfo = (data: FacilityInfoForm) => {
  return request({
    url: '/apartment/facilityInfo',
    method: 'put',
    data: data
  });
};

/**
 * 删除配套信息
 * @param id
 */
export const delFacilityInfo = (id: string | number | Array<string | number>) => {
  return request({
    url: '/apartment/facilityInfo/' + id,
    method: 'delete'
  });
};
